package com.sizu.web;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sizu.common.saledto.TCustomerDto;
import com.sizu.common.vo.ResultEntity;
import com.sizu.entity.TCustomer;
import com.sizu.service.ITCustomerService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-02-26
 */
@RestController
@RequestMapping("/sale/tCustomer")
public class TCustomerController {

    @Resource
    private ITCustomerService itCustomerService;


    /**
     * 查询客户列表
     * @param tCustomerDto
     * @return
     */
    @RequestMapping("/list")
    public ResultEntity tCustomerList(TCustomerDto tCustomerDto){
        TCustomer tCustomer=new TCustomer();
        BeanUtils.copyProperties(tCustomerDto,tCustomer);
        Wrapper<TCustomer> wrapper=new EntityWrapper<>();
        wrapper.ne("enable",0);
        List<TCustomer> tCustomers = itCustomerService.selectList(wrapper);

        return ResultEntity.ok("查询成功",tCustomers);
    }


}
